use dotenvy::dotenv;
use log::debug;
use log::error;
use log::info;
use log::warn;
use common_lib::AppError;

#[test]
fn test_log() {
    // env_logger::init();
    dotenv().ok();
    env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
    // let t:Result<(), AppError> = Err(AppError::from("InvalidArgument"));
    // info!("{:?}",t);
    debug!("Mary has a little lamb");
    error!("{}", "Its fleece was white as snow");
    info!("{:?}", "And every where that Mary went");
    warn!("{:#?}", "The lamb was sure to go");
}


fn find_first_positive(nums: &[i32], is_positive: impl Fn(i32) -> bool) -> Option<usize> {
    nums.iter().position(|&x| is_positive(x))
}

fn main() {
    let reference_to_nothing = dangle();
}

fn dangle() -> &String {
    let s = String::from("hello");

    &s
}